'use strict';

const { Controller } = require('egg');

class RoleController extends Controller {
    async rolelist() {
        const { ctx } = this;
        let params = ctx.request.body
        console.log(params);
        let res = await this.service.user.rolelist(params)
        if (res.status) {
            let token = await this.ctx.helper.siginToken(res.data)
            ctx.body = {
                code: res.code,
                message: res.message,
                data: {
                    token: 'Bearer ' + token,
                    userInfo: res.data
                }
            }
        } else {
            ctx.body = {
                code: res.code,
                message: res.message,
                data: res.data
            }
        }

    }
}

module.exports = RoleController;
